<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>新开卡结算</title>
<style type="text/css">
</style>
<script type="text/javascript">
$().ready(function(){
disableExitMenu();
});
</script>
<meta name="decorator" content="default" />
</head>
<body>
	<div data-role="navbar">
		<ul>
			<li><a href="#" class="ui-btn-active">新开卡消费结算</a></li>
			<c:if test="${member.menuState.hasRecharges}">
				<li><a href="${ctx}/cash/member/shoppingDetails/recharge">卡充值消费结算</a></li>
			</c:if>
			<c:if test="${member.menuState.hasProducts}">
				<li><a href="${ctx}/cash/member/shoppingDetails/product">购买产品消费结算</a></li>
			</c:if>
			<c:if test="${member.menuState.hasCares}">
				<li><a href="${ctx}/cash/member/shoppingDetails/docare">手工护理消费结算</a></li>
			</c:if>
			<c:if test="${member.menuState.hasGifts}">
				<li><a href="${ctx}/cash/member/shoppingDetails/gift">赠品</a></li>
			</c:if>
		</ul>
	</div>
	<div class="container">
		<h2 style="text-align: center;">确认结算方式</h2>
		<form action="${ctx}/cash/member/shoppingPayment" method="post">
			<div class="icon-buttons">
				<a href="${ctx}/cash/member/detail?id=${member.customer.id}"
					data-inline="true" data-role="button" data-icon="back"
					data-iconpos="notext"> 返回</a> <input type="submit"
					data-icon="check" data-iconpos="notext" data-inline="true"
					value="结算" />
			</div>
		</form>
		<tags:message content="${message}" />
		<div>
			<div>
				<div data-role="fieldcontain">
					<label><strong>总计新开卡费用(元)：</strong></label> <input id="totalMonney"
						type="text" readonly
						value="${member.newCards.cardsPayment.totalRealCost}" />
				</div>
				<div data-role="fieldcontain">
					<label><strong>共需支付(元)：</strong></label><input id="totalMonney"
						type="text" readonly
						value="${member.newCards.cardsPayment.totalRealCost}" />
				</div>
				<ol>
					<c:if test="${member.newCards.cardsPayment.totalCashCost>0}">
						<li><strong>使用现金金支付: </strong> ${
							member.newCards.cardsPayment.totalCashCost}</li>
					</c:if>
					<c:if
						test="${(member.newCards.cardsPayment.totalRealCost-member.newCards.cardsPayment.totalCashCost)>0}">
						<li><strong>使用充值卡支付: </strong>
							${member.newCards.cardsPayment.totalRealCost-member.newCards.cardsPayment.totalCashCost}</li>
					</c:if>
				</ol>
			</div>
		</div>
		<c:if test="${not empty  member.newCards.timesCards}">
			<div>
				<table id="contentTableCardTimes" data-role="table"
					class="ui-responsive table-stroke">
					<thead>
						<tr>
							<th colspan="7" style="text-align:center;">计次护理卡</th>
						</tr>
						<tr>
							<th>卡名</th>
							<th>护理项目</th>
							<th>护理间隔</th>
							<th>护理次数</th>
							<th>服务专员</th>
							<th>零售价</th>
							<th>店面优惠价</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${member.newCards.timesCards}" var="cart">
							<tr>
								<td id="name">${cart.card.template.name}</td>
								<c:if test="${cart.card.template.storeCare.care_type==0}">
									<td>${cart.card.template.storeCare.care.name}</td>
									<td>${cart.card.template.storeCare.care.duration}</td>
								</c:if>
								<c:if test="${cart.card.template.storeCare.care_type==1}">
									<td>${cart.card.template.storeCare.storeSelfCare.name}</td>
									<td>${cart.card.template.storeCare.storeSelfCare.duration}</td>
								</c:if>
								<td>${cart.card.template.times}</td>
								<td>${cart.employee.name}</td>
								<td>${cart.card.template.retail_price}</td>
								<td>${cart.real_cost}</td>
							</tr>
						</c:forEach>
						<tr class="warning">
							<td colspan="5">合计</td>
							<td>${member.newCards.cardsPayment.totalRequiredCostForTimes}</td>
							<td>${member.newCards.cardsPayment.totalRealCostForTimes}</td>
						</tr>
					</tbody>
				</table>
				<br /> <br />
			</div>
		</c:if>
		<c:if test="${not empty  member.newCards.durationCards}">
			<div>
				<table id="contentTableCardDuration" data-role="table"
					class="ui-responsive table-stroke">
					<thead>
						<tr>
							<th colspan="7" style="text-align:center;">时段护理卡</th>
						</tr>
						<tr>
							<th>卡名</th>
							<th>护理项目</th>
							<th>护理间隔</th>
							<th>护理时段</th>
							<th>服务专员</th>
							<th>零售价</th>
							<th>店面优惠价</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${member.newCards.durationCards}" var="cart">
							<tr>
								<td id="name">${cart.card.template.name}</td>
								<c:if test="${cart.card.template.storeCare.care_type==0}">
									<td>${cart.card.template.storeCare.care.name}</td>
									<td>${cart.card.template.storeCare.care.duration}</td>
								</c:if>
								<c:if test="${cart.card.template.storeCare.care_type==1}">
									<td>${cart.card.template.storeCare.storeSelfCare.name}</td>
									<td>${cart.card.template.storeCare.storeSelfCare.duration}</td>
								</c:if>
								<td>${cart.card.template.duration}</td>
								<td>${cart.employee.name}</td>
								<td>${cart.card.template.retail_price}</td>
								<td>${cart.real_cost}</td>
							</tr>
						</c:forEach>
						<tr class="warning">
							<td colspan="5">合计</td>
							<td>${member.newCards.cardsPayment.totalRequiredCostForDuration}</td>
							<td>${member.newCards.cardsPayment.totalRealCostForDuration}</td>
						</tr>

					</tbody>
				</table>
			</div>
			<br />
			<br />
		</c:if>
		<c:if test="${not empty member.newCards.productCards}">

			<div>
				<table id="contentTableCardProduct" data-role="table"
					class="ui-responsive table-stroke">
					<thead>
						<tr>
							<th colspan="6" style="text-align:center;">产品充值卡</th>
						</tr>
						<tr>
							<th>卡名</th>
							<th>适用产品</th>
							<th>产品折扣</th>
							<th>服务专员</th>
							<th>零售价</th>
							<th>店面优惠价</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${member.newCards.productCards}" var="cart">
							<tr>
								<td id="name">${cart.card.template.name}</td>
								<td>护理时段</td>
								<td>${cart.card.template.discount}</td>
								<td>${cart.employee.name}</td>
								<td>${cart.card.template.retail_price}</td>
								<td>${cart.real_cost}</td>
							</tr>
						</c:forEach>
						<tr class="warning">
							<td colspan="4">合计</td>
							<td>${member.newCards.cardsPayment.totalRequiredCostForProduct}</td>
							<td>${member.newCards.cardsPayment.totalRealCostForProduct}</td>
						</tr>
					</tbody>
				</table>
			</div>
		</c:if>
		<c:if test="${not empty member.newCards.allCards}">
			<div>
				<br /> <br />
				<table id="contentTableCardAll" data-role="table"
					class="ui-responsive table-stroke">
					<thead>
						<tr>
							<th colspan="6" style="text-align:center;">综合充值卡</th>
						</tr>
						<tr>
							<th>卡名</th>
							<th>产品折扣</th>
							<th>护理折扣</th>
						   <th>服务专员</th>
							<th>零售价</th>
							<th>店面优惠价</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${member.newCards.allCards}" var="cart">
							<tr id="${cart.card.id}">
								<td id="name">${cart.card.template.name}</td>
								<td>${cart.card.template.product_discount}</td>
								<td>${cart.card.template.care_discount}</td>
								<td>${cart.employee.name}</td>
								<td>${cart.card.template.retail_price}</td>
								<td>${cart.real_cost}</td>
							</tr>
						</c:forEach>
						<tr class="warning">
							<td colspan="4">合计</td>
							<td>${member.newCards.cardsPayment.totalRequiredCostForAll}</td>
							<td>${member.newCards.cardsPayment.totalRealCostForAll}</td>
						</tr>
					</tbody>
				</table>
			</div>
		</c:if>
	</div>
	<br/>
	<br/>
	<br/>
</body>
</html>
